<template>
	<view>
		<dsl-navbar title="公告详情" isBack bgTopImg="white"></dsl-navbar>
		<view class="title">
			{{messageData.title}}
		</view>
		<view class="padding text-sm text-gray">
			<text>{{messageData.issueName}}</text>
			<text class="margin-left">{{messageData.createtime | formatDate}}</text>
		</view>
		<view class="notice_bottom solid-top">
			<view class="margin-left">{{messageData.unread}}人未读</view>
			<view class="margin-left">{{messageData.read}}人已读</view>
		</view>
		<view class="padding">
			<view v-html="messageData.content"></view>
		</view>
	</view>
</template>

<script>
	import {
		getmessageDetail
	} from '@/common/path.js'
	export default {
		data() {
			return {
				detailId: '', //详情id
				messageData:{}
			}
		},
		//生命周期函数
		onReady() {},
		onLoad(option) {
			this.detailId = option.id
			this.getmessageDetail()
		},
		filters: {
		    formatDate(data) { //时间戳的过滤
		        var date = new Date(data * 1000); //时间戳为10位需*1000，时间戳为13位的话不需乘1000
		        var Y = date.getFullYear() + '-';
		        var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
		        var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
		        var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
		       var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
		        var s = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
		        return Y + M + D + h + m + s;
		        },
		    },
		onShow() {},
		methods: {
			//公告详情
			getmessageDetail() {
				let data ={
					id:this.detailId
				}
				this.Http.POST(getmessageDetail, data)
					.then((res) => {
						if (res.code == 1) {
							console.log('[公告详情]', res);
							this.messageData = res.data
						}
					})
			}
		},
		computed: {},
		components: {}
	}
</script>

<style>
	.title {
		font-size: 36rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #333333;
		padding: 30rpx;
		padding-bottom: 1rpx;
	}

	.notice_bottom {
		width: 750rpx;
		height: 98rpx;
		background: #FFFFFF;
		line-height: 98rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #999999;
		opacity: 1;
		display: flex;
		align-items: center;
		position: fixed;
		bottom: 0;

	}
</style>
